package innreservations;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.ArrayList;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;

/**
 *
 * @author Ethan Frame, Grant Frame, Tim Phan
 */
public class InnReservationUI extends javax.swing.JFrame {

    private static final int ON = 1;
    private static final int ENTER = 10;
    
    private boolean view_rooms = false;
    private boolean view_reservations = false;
    
    private boolean occupied_entered = false;
    
    public static int res_code = 100000;
    
    /**
     * Creates new form InnReservationUI
     */
    public InnReservationUI() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        MainPanel = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        DatabaseStatusLabel = new javax.swing.JLabel();
        ReservationsLabel = new javax.swing.JLabel();
        RoomsLabel = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        TableList = new javax.swing.JList();
        jPanel4 = new javax.swing.JPanel();
        ClearDatabaseButton = new javax.swing.JButton();
        LoadDatabaseButton = new javax.swing.JButton();
        DeleteDatabaseButton = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel6 = new javax.swing.JPanel();
        StartDateLabel = new javax.swing.JLabel();
        StartDateTextFieldOccupancy = new javax.swing.JFormattedTextField();
        EndDateLabel = new javax.swing.JLabel();
        EndDateTextFieldOccupancy = new javax.swing.JFormattedTextField();
        OccupiedDateLabel = new javax.swing.JLabel();
        OccupiedDateTextFieldPOccupancy = new javax.swing.JFormattedTextField();
        jScrollPane2 = new javax.swing.JScrollPane();
        RoomList = new javax.swing.JList();
        jLabel2 = new javax.swing.JLabel();
        ReservationInformationTextAreaOccupancy = new javax.swing.JScrollPane();
        ReservationTextAreaOccupancy = new javax.swing.JTextArea();
        jLabel15 = new javax.swing.JLabel();
        jScrollPane13 = new javax.swing.JScrollPane();
        ReservationListOwner = new javax.swing.JList();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        RevenueTable = new javax.swing.JTable();
        ReservationCounts = new javax.swing.JButton();
        DaysOccupiedButton = new javax.swing.JButton();
        RevenueButton = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        StartDateTextFieldReservations = new javax.swing.JFormattedTextField();
        jLabel4 = new javax.swing.JLabel();
        EndDateTextFieldReservations = new javax.swing.JFormattedTextField();
        jLabel5 = new javax.swing.JLabel();
        RoomSelectionReservations = new javax.swing.JComboBox();
        jScrollPane4 = new javax.swing.JScrollPane();
        ReservationListReservations = new javax.swing.JList();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        ReservationInfoTextAreaReservations = new javax.swing.JTextArea();
        jPanel9 = new javax.swing.JPanel();
        jLabel7 = new javax.swing.JLabel();
        RoomSelectionRooms = new javax.swing.JComboBox();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        ReservationListRooms = new javax.swing.JList();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        RoomInfoTextAreaRooms = new javax.swing.JTextArea();
        jScrollPane9 = new javax.swing.JScrollPane();
        ReservationInfoTextAreaRooms = new javax.swing.JTextArea();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel11 = new javax.swing.JPanel();
        jLabel16 = new javax.swing.JLabel();
        RoomSelectionGuest = new javax.swing.JComboBox();
        jLabel17 = new javax.swing.JLabel();
        CheckAvailabilityButton = new javax.swing.JButton();
        jScrollPane7 = new javax.swing.JScrollPane();
        AvailabilityList = new javax.swing.JTable();
        jLabel18 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        StartDateTextFieldGuest = new javax.swing.JFormattedTextField();
        jLabel20 = new javax.swing.JLabel();
        EndDateTextFieldGuest = new javax.swing.JFormattedTextField();
        PlaceReservationButton = new javax.swing.JButton();
        PlaceReservationButton.setVisible(false);
        ReservationCompletedLabel = new javax.swing.JLabel();
        ReservationCompletedLabel.setVisible(false);
        jScrollPane10 = new javax.swing.JScrollPane();
        RoomInfoTextAreaGuest = new javax.swing.JTextArea();
        jPanel10 = new javax.swing.JPanel();
        jLabel11 = new javax.swing.JLabel();
        StartDateTextFieldGuestReservations = new javax.swing.JFormattedTextField();
        jLabel12 = new javax.swing.JLabel();
        EndDateTextFieldGuestReservations = new javax.swing.JFormattedTextField();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane11 = new javax.swing.JScrollPane();
        RoomInfoTextAreaGuestReservations = new javax.swing.JTextArea();
        jScrollPane12 = new javax.swing.JScrollPane();
        AvailabilityTableReservations = new javax.swing.JTable();
        jLabel14 = new javax.swing.JLabel();
        MakeAReservation = new javax.swing.JButton();
        MakeAReservation.setVisible(false);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Current Status");

        DatabaseStatusLabel.setText("Database Status: ");

        ReservationsLabel.setText("Reservations: ");

        RoomsLabel.setText("Rooms: ");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup()
                        .add(0, 500, Short.MAX_VALUE)
                        .add(jLabel1)
                        .add(384, 384, 384))
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(DatabaseStatusLabel)
                            .add(ReservationsLabel)
                            .add(RoomsLabel))
                        .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel1)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(DatabaseStatusLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(ReservationsLabel)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(RoomsLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(31, Short.MAX_VALUE))
        );

        jRadioButton1.setText("View Rooms Table");
        jRadioButton1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ViewRoomsTable(evt);
            }
        });

        jRadioButton2.setText("View Reservations Table");
        jRadioButton2.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                ViewReservationsTable(evt);
            }
        });

        TableList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jScrollPane1.setViewportView(TableList);

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jRadioButton1)
                    .add(jRadioButton2))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane1)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 234, Short.MAX_VALUE)
                    .add(jPanel3Layout.createSequentialGroup()
                        .add(jRadioButton1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jRadioButton2)
                        .add(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );

        ClearDatabaseButton.setText("Clear Database");
        ClearDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ClearDataBase(evt);
            }
        });

        LoadDatabaseButton.setText("Load Database");
        LoadDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                LoadDatabase(evt);
            }
        });

        DeleteDatabaseButton.setText("Delete Datebase");
        DeleteDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DeleteDatabase(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel4Layout = new org.jdesktop.layout.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(ClearDatabaseButton)
                    .add(LoadDatabaseButton)
                    .add(DeleteDatabaseButton))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .add(ClearDatabaseButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(LoadDatabaseButton)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(DeleteDatabaseButton)
                .addContainerGap(140, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        MainPanel.addTab("Admin", jPanel1);

        StartDateLabel.setText("Start Date:");

        StartDateTextFieldOccupancy.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        StartDateTextFieldOccupancy.setText("Month, Day");
        StartDateTextFieldOccupancy.setFocusLostBehavior(javax.swing.JFormattedTextField.COMMIT);

        EndDateLabel.setText("End Date:");

        EndDateTextFieldOccupancy.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        EndDateTextFieldOccupancy.setText("Month, Day");
        EndDateTextFieldOccupancy.setFocusLostBehavior(javax.swing.JFormattedTextField.COMMIT);
        EndDateTextFieldOccupancy.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EndDateEnteredOccupancy(evt);
            }
        });

        OccupiedDateLabel.setText("Occupied Date:");

        OccupiedDateTextFieldPOccupancy.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        OccupiedDateTextFieldPOccupancy.setText("Month, Day");
        OccupiedDateTextFieldPOccupancy.setFocusLostBehavior(javax.swing.JFormattedTextField.COMMIT);
        OccupiedDateTextFieldPOccupancy.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                OccupiedDateEnteredOccupancy(evt);
            }
        });

        RoomList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        RoomList.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                RoomSelected(evt);
            }
        });
        jScrollPane2.setViewportView(RoomList);

        jLabel2.setText("Reservation Information: ");

        ReservationTextAreaOccupancy.setEditable(false);
        ReservationTextAreaOccupancy.setColumns(20);
        ReservationTextAreaOccupancy.setRows(5);
        ReservationInformationTextAreaOccupancy.setViewportView(ReservationTextAreaOccupancy);

        jLabel15.setText("Reservation List:");

        ReservationListOwner.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                ReservationSelectedOwner(evt);
            }
        });
        jScrollPane13.setViewportView(ReservationListOwner);

        org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jScrollPane2)
                    .add(jPanel6Layout.createSequentialGroup()
                        .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(OccupiedDateLabel)
                            .add(StartDateLabel)
                            .add(EndDateLabel))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 64, Short.MAX_VALUE)
                        .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(OccupiedDateTextFieldPOccupancy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 135, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(StartDateTextFieldOccupancy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 135, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(EndDateTextFieldOccupancy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 135, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(102, 102, 102)))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jLabel2)
                    .add(jLabel15)
                    .add(jScrollPane13, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)
                    .add(ReservationInformationTextAreaOccupancy))
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel6Layout.createSequentialGroup()
                .add(7, 7, 7)
                .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(OccupiedDateLabel)
                    .add(OccupiedDateTextFieldPOccupancy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel15))
                .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel6Layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(StartDateLabel)
                            .add(StartDateTextFieldOccupancy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(EndDateLabel)
                            .add(EndDateTextFieldOccupancy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(74, 74, 74)
                        .add(jScrollPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 399, Short.MAX_VALUE))
                    .add(jPanel6Layout.createSequentialGroup()
                        .add(2, 2, 2)
                        .add(jScrollPane13)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel2)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(ReservationInformationTextAreaOccupancy, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 284, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jTabbedPane2.addTab("Occupancy", jPanel6);

        RevenueTable.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, "", "", null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null, null, null, null, null, null, null, null}
            },
            new String [] {
                "Room", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC", "Total"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Object.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(RevenueTable);

        ReservationCounts.setText("Reservation Counts");
        ReservationCounts.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ReservationCounts(evt);
            }
        });

        DaysOccupiedButton.setText("Days Occupied");
        DaysOccupiedButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                DaysOccupied(evt);
            }
        });

        RevenueButton.setText("Revenue");
        RevenueButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Revenue(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel7Layout.createSequentialGroup()
                        .add(jScrollPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 941, Short.MAX_VALUE)
                        .addContainerGap())
                    .add(jPanel7Layout.createSequentialGroup()
                        .add(ReservationCounts, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 160, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(DaysOccupiedButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(RevenueButton)
                        .add(0, 0, Short.MAX_VALUE))))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(ReservationCounts)
                    .add(DaysOccupiedButton)
                    .add(RevenueButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 127, Short.MAX_VALUE)
                .add(jScrollPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane2.addTab("Revenue", jPanel7);

        jLabel3.setText("Start Date:");

        StartDateTextFieldReservations.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        StartDateTextFieldReservations.setText("Month, Day");
        StartDateTextFieldReservations.setFocusLostBehavior(javax.swing.JFormattedTextField.COMMIT);

        jLabel4.setText("End Date:");

        EndDateTextFieldReservations.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        EndDateTextFieldReservations.setText("Month, Day");
        EndDateTextFieldReservations.setFocusLostBehavior(javax.swing.JFormattedTextField.COMMIT);
        EndDateTextFieldReservations.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EndDateEnteredReservations(evt);
            }
        });

        jLabel5.setText("Room:");

        RoomSelectionReservations.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All Rooms", "Abscond or bolster", "Convoke and sanguine", "Frugal not apropos", "Harbinger but bequest", "Immutable before decorum", "Interim but salutary", "Mendicant with cryptic", "Recluse and defiance", "Riddle to exculpate", "Thrift and accolade" }));
        RoomSelectionReservations.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RoomSelectedReservations(evt);
            }
        });

        ReservationListReservations.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        ReservationListReservations.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                ReservationSelected(evt);
            }
        });
        jScrollPane4.setViewportView(ReservationListReservations);

        jLabel6.setText("Reservation Information:");

        ReservationInfoTextAreaReservations.setEditable(false);
        ReservationInfoTextAreaReservations.setColumns(20);
        ReservationInfoTextAreaReservations.setRows(5);
        jScrollPane6.setViewportView(ReservationInfoTextAreaReservations);

        org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                        .add(jPanel8Layout.createSequentialGroup()
                            .add(jLabel3)
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                            .add(StartDateTextFieldReservations))
                        .add(jPanel8Layout.createSequentialGroup()
                            .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jLabel4)
                                .add(jLabel5))
                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                            .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(RoomSelectionReservations, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .add(EndDateTextFieldReservations))))
                    .add(jScrollPane4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 350, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel8Layout.createSequentialGroup()
                        .add(jLabel6)
                        .add(0, 0, Short.MAX_VALUE))
                    .add(jScrollPane6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel8Layout.createSequentialGroup()
                        .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel3)
                            .add(StartDateTextFieldReservations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel4)
                            .add(EndDateTextFieldReservations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(RoomSelectionReservations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel5))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 475, Short.MAX_VALUE))
                    .add(jPanel8Layout.createSequentialGroup()
                        .add(jLabel6)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane6)))
                .addContainerGap())
        );

        jTabbedPane2.addTab("Reservations", jPanel8);

        jLabel7.setText("Select Room:");

        RoomSelectionRooms.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Choose Room", "Abscond or bolster", "Convoke and sanguine", "Frugal not apropos", "Harbinger but bequest", "Immutable before decorum", "Interim but salutary", "Mendicant with cryptic", "Recluse and defiance", "Riddle to exculpate", "Thrift and accolade" }));
        RoomSelectionRooms.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RoomSelectedRooms(evt);
            }
        });

        jLabel8.setText("Room Information:");

        jLabel9.setText("Reservations:");

        ReservationListRooms.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        ReservationListRooms.addListSelectionListener(new ListSelectionListener() {
            public void valueChanged(ListSelectionEvent evt) {
                ReservationSelectedRooms(evt);
            }
        });
        jScrollPane5.setViewportView(ReservationListRooms);

        jLabel10.setText("Reservation Information:");

        RoomInfoTextAreaRooms.setEditable(false);
        RoomInfoTextAreaRooms.setColumns(20);
        RoomInfoTextAreaRooms.setRows(5);
        jScrollPane8.setViewportView(RoomInfoTextAreaRooms);

        ReservationInfoTextAreaRooms.setEditable(false);
        ReservationInfoTextAreaRooms.setColumns(20);
        ReservationInfoTextAreaRooms.setRows(5);
        jScrollPane9.setViewportView(ReservationInfoTextAreaRooms);

        org.jdesktop.layout.GroupLayout jPanel9Layout = new org.jdesktop.layout.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel9Layout.createSequentialGroup()
                        .add(jLabel7)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(RoomSelectionRooms, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jLabel9)
                    .add(jScrollPane5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 277, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 610, Short.MAX_VALUE)
                    .add(jScrollPane9)
                    .add(jPanel9Layout.createSequentialGroup()
                        .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel8)
                            .add(jLabel10))
                        .add(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel7)
                    .add(RoomSelectionRooms, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel8))
                .add(jPanel9Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel9Layout.createSequentialGroup()
                        .add(137, 137, 137)
                        .add(jLabel9)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 390, Short.MAX_VALUE))
                    .add(jPanel9Layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jScrollPane8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
                        .add(18, 18, 18)
                        .add(jLabel10)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jScrollPane9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 258, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        jTabbedPane2.addTab("Rooms", jPanel9);

        org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .add(jTabbedPane2)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .add(jTabbedPane2)
                .addContainerGap())
        );

        MainPanel.addTab("Owner", jPanel5);

        jLabel16.setText("Room:");

        RoomSelectionGuest.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "---", "Abscond or bolster", "Convoke and sanguine", "Frugal not apropos", "Harbinger but bequest", "Immutable before decorum", "Interim but salutary", "Mendicant with cryptic", "Recluse and defiance", "Riddle to exculpate", "Thrift and accolade" }));
        RoomSelectionGuest.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RoomSelectionGuest(evt);
            }
        });

        jLabel17.setText("Room Information:");

        CheckAvailabilityButton.setText("Check Availability");
        CheckAvailabilityButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CheckAvailability(evt);
            }
        });

        AvailabilityList.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Night", "Availability", "Rate"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane7.setViewportView(AvailabilityList);

        jLabel18.setText("Availability:");

        jLabel19.setText("Start Date:");

        StartDateTextFieldGuest.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        StartDateTextFieldGuest.setText("Month, Day");
        StartDateTextFieldGuest.setFocusLostBehavior(javax.swing.JFormattedTextField.COMMIT);

        jLabel20.setText("End Date:");

        EndDateTextFieldGuest.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        EndDateTextFieldGuest.setText("Month, Day");
        EndDateTextFieldGuest.setFocusLostBehavior(javax.swing.JFormattedTextField.COMMIT);

        PlaceReservationButton.setText("Place Reservation");
        PlaceReservationButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                PlaceReservation(evt);
            }
        });

        RoomInfoTextAreaGuest.setEditable(false);
        RoomInfoTextAreaGuest.setColumns(20);
        RoomInfoTextAreaGuest.setRows(5);
        jScrollPane10.setViewportView(RoomInfoTextAreaGuest);

        org.jdesktop.layout.GroupLayout jPanel11Layout = new org.jdesktop.layout.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane7, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 878, Short.MAX_VALUE)
                    .add(jPanel11Layout.createSequentialGroup()
                        .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel11Layout.createSequentialGroup()
                                .add(jLabel16)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(RoomSelectionGuest, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(CheckAvailabilityButton)
                            .add(jLabel18)
                            .add(jPanel11Layout.createSequentialGroup()
                                .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                    .add(jLabel19)
                                    .add(jLabel20))
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                    .add(StartDateTextFieldGuest, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE)
                                    .add(EndDateTextFieldGuest))))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel11Layout.createSequentialGroup()
                                .add(jLabel17)
                                .add(0, 0, Short.MAX_VALUE))
                            .add(jScrollPane10, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 669, Short.MAX_VALUE)))
                    .add(jPanel11Layout.createSequentialGroup()
                        .add(PlaceReservationButton)
                        .add(374, 374, 374)
                        .add(ReservationCompletedLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel16)
                    .add(RoomSelectionGuest, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel17))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jPanel11Layout.createSequentialGroup()
                        .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel19)
                            .add(StartDateTextFieldGuest, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                            .add(jLabel20)
                            .add(EndDateTextFieldGuest, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(CheckAvailabilityButton)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel18))
                    .add(jScrollPane10))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 275, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jPanel11Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(PlaceReservationButton)
                    .add(ReservationCompletedLabel))
                .add(120, 120, 120))
        );

        jTabbedPane1.addTab("Rooms and Rates", jPanel11);

        jLabel11.setText("Start Date:");

        StartDateTextFieldGuestReservations.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        StartDateTextFieldGuestReservations.setText("Month, Day");

        jLabel12.setText("End Date:");

        EndDateTextFieldGuestReservations.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter(new java.text.SimpleDateFormat("MMMM, d"))));
        EndDateTextFieldGuestReservations.setText("Month, Day");
        EndDateTextFieldGuestReservations.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                EndDateEnteredGuestReservations(evt);
            }
        });

        jLabel13.setText("Room Information:");

        RoomInfoTextAreaGuestReservations.setColumns(20);
        RoomInfoTextAreaGuestReservations.setEditable(false);
        RoomInfoTextAreaGuestReservations.setRows(5);
        jScrollPane11.setViewportView(RoomInfoTextAreaGuestReservations);

        AvailabilityTableReservations.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Room Name", "Rate"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        AvailabilityTableReservations.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                AvailabilityTableReservationsMouseClicked(evt);
            }
        });
        jScrollPane12.setViewportView(AvailabilityTableReservations);

        jLabel14.setText("Available Rooms");

        MakeAReservation.setText("Make a Reservation");
        MakeAReservation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                MakeReservation(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel10Layout = new org.jdesktop.layout.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel10Layout.createSequentialGroup()
                        .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                .add(jPanel10Layout.createSequentialGroup()
                                    .add(jLabel11)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                    .add(StartDateTextFieldGuestReservations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 135, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                                .add(jPanel10Layout.createSequentialGroup()
                                    .add(jLabel12)
                                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                                    .add(EndDateTextFieldGuestReservations)))
                            .add(jLabel14))
                        .add(84, 84, 84)
                        .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanel10Layout.createSequentialGroup()
                                .add(jLabel13)
                                .add(0, 0, Short.MAX_VALUE))
                            .add(jScrollPane11, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 662, Short.MAX_VALUE)))
                    .add(jPanel10Layout.createSequentialGroup()
                        .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(MakeAReservation)
                            .add(jScrollPane12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 289, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel11)
                    .add(StartDateTextFieldGuestReservations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel13))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jPanel10Layout.createSequentialGroup()
                        .add(jLabel12)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .add(jLabel14))
                    .add(EndDateTextFieldGuestReservations, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jScrollPane11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 128, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jScrollPane12, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 282, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(MakeAReservation)
                .addContainerGap(109, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Reservations", jPanel10);

        MainPanel.addTab("Guest", jTabbedPane1);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(MainPanel)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(MainPanel)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void RoomSelectedRooms(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RoomSelectedRooms
        String room = (String) RoomSelectionRooms.getSelectedItem();

        if(!room.equals("Choose Room")) {
            // get room info from database
            String room_info = InnReservations.get_room_info(room, true);
            RoomInfoTextAreaRooms.setText(room_info);

            // get reservations info from database
            String[] values = InnReservations.reservations_for_room(room);
            ReservationListRooms.setListData(values);
        } else {
            RoomInfoTextAreaRooms.setText("");

            String[] values = {""};
            ReservationListRooms.setListData(values);
        }
    }//GEN-LAST:event_RoomSelectedRooms

    private void RoomSelectedReservations(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RoomSelectedReservations
        String room = (String) RoomSelectionReservations.getSelectedItem();
        String startDate = InnReservations.format_date(StartDateTextFieldReservations.getText());
        String endDate = InnReservations.format_date(EndDateTextFieldReservations.getText());
        ArrayList<String> values = new ArrayList<String>();
        ResultSet result;
        String[] reservations;
        
        if(StartDateTextFieldReservations.isEditValid() && EndDateTextFieldReservations.isEditValid()
            && !startDate.isEmpty() && !endDate.isEmpty()) {

                try {
                    Statement s = InnReservations.conn.createStatement();
                    if(room.equals("All Rooms")) {
                        result = s.executeQuery("select code, room, check_in, check_out "
                                                + "from reservations "
                                                + "where check_in >= '" + startDate + "' and"
                                                + " check_in < '" + endDate + "'");
                    }
                    else {
                        result = s.executeQuery("select re.code, re.room, re.check_in, re.check_out "
                                                + "from reservations re, rooms r "
                                                + "where re.room = r.room_id and r.room_name = '" + room + "' and "
                                                + "check_in >= '" + startDate + "' and check_in < '" + endDate + "'");
                    }
                    while(result.next()) {
                        values.add(result.getString(1) + ", " + result.getString(2) + 
                                ", " + result.getDate(3) + ", " + result.getDate(4));
                    }
                    
                    reservations = values.toArray(new String[values.size()]);
                    ReservationListReservations.setListData(reservations);
                }catch (Exception ee) {}

        } else {
            try {                
                Statement s = InnReservations.conn.createStatement();
                if(room.equals("All Rooms")) {
                    result = s.executeQuery("select re.code, re.room, re.check_in, re.check_out "
                                + "from reservations re");
                    while(result.next()) {
                        values.add(result.getString(1) + ", " + result.getString(2) + 
                                ", " + result.getDate(3) + ", " + result.getDate(4));
                    }
                    reservations = values.toArray(new String[values.size()]);
                }
                else {
                    reservations = InnReservations.reservations_for_room(room);
                }
                ReservationListReservations.setListData(reservations);
                }
            catch (Exception ee) {
                System.out.println(ee);
            }
        }
    }//GEN-LAST:event_RoomSelectedReservations

    private void EndDateEnteredReservations(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EndDateEnteredReservations
        if(evt.getKeyCode() == ENTER) {

            String room = (String) RoomSelectionReservations.getSelectedItem();
            String startDate = InnReservations.format_date(StartDateTextFieldReservations.getText());
            String endDate = InnReservations.format_date(EndDateTextFieldReservations.getText());
            ArrayList<String> values = new ArrayList<String>();
            ResultSet result;
            String[] reservations;
            
            if(StartDateTextFieldReservations.isEditValid() && EndDateTextFieldReservations.isEditValid()
                && !startDate.isEmpty() && !endDate.isEmpty()) {
                try {
                    Statement s = InnReservations.conn.createStatement();
                    if(room.equals("All Rooms")) {
                        result = s.executeQuery("select code, room, check_in, check_out "
                                                + "from reservations "
                                                + "where check_in >= '" + startDate + "' and"
                                                + " check_in < '" + endDate + "'");
                    }
                    else {
                        result = s.executeQuery("select re.code, re.room, re.check_in, re.check_out "
                                                + "from reservations re, rooms r "
                                                + "where re.room = r.room_id and r.room_name = '" + room + "' and "
                                                + "check_in >= '" + startDate + "' and check_in < '" + endDate + "'");
                    }
                    while(result.next()) {
                        values.add(result.getString(1) + ", " + result.getString(2) + 
                                ", " + result.getDate(3) + ", " + result.getDate(4));
                    }
                    
                    reservations = values.toArray(new String[values.size()]);
                    ReservationListReservations.setListData(reservations);
                }catch (Exception ee) {}
            }
        }
    }//GEN-LAST:event_EndDateEnteredReservations

    private void Revenue(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Revenue
        int rowCount = 0;
        int count = 0;
        double total = 0;
        double sum = 0;
        
        try {
            Statement s = InnReservations.conn.createStatement();
            ResultSet result = s.executeQuery("select r.room_name, to_char(re.check_out, 'MM') as MONTH, sum((re.check_out - re.check_in)*re.rate) " +
                                              "from reservations re, rooms r " +
                                              "where re.room = r.room_id " +
                                              "group by r.room_name, to_char(re.check_out, 'MM') " +
                                              "order by r.room_name, MONTH asc");
            while(result.next()) {
                if(count == 0) {
                    RevenueTable.setValueAt(result.getString(1), rowCount, count++);
                    RevenueTable.setValueAt(result.getDouble(3), rowCount, count++);
                    total += result.getDouble(3);
                }
                else {
                    RevenueTable.setValueAt(result.getDouble(3), rowCount, count++);
                    total += result.getDouble(3);
                    if (count == 13) {
                        RevenueTable.setValueAt(total, rowCount, count);
                        count = 0;
                        total = 0;
                        rowCount++;
                    }
                }
            }
            
            RevenueTable.setValueAt("Totals", rowCount, 0);
            
            for(int i = 1; i < 14; i++) {
                sum = 0;
                for(int j = 0; j < 10; j++) {
                    sum += (Double)RevenueTable.getValueAt(j, i);
                }
                RevenueTable.setValueAt(sum, 10, i);
            }
        }
        catch (Exception ee) {
            System.out.println(ee);
        }
    }//GEN-LAST:event_Revenue

    private void DaysOccupied(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DaysOccupied
        int rowCount = 0;
        int count = 0;
        int total = 0;
        int sum;
        
        try {
            Statement s = InnReservations.conn.createStatement();
            ResultSet result = s.executeQuery("select r.room_name, to_char(re.check_out, 'MM') as MONTH, sum(re.check_out - re.check_in) " +
                                              "from reservations re, rooms r " +
                                              "where re.room = r.room_id " +
                                              "group by r.room_name, to_char(re.check_out, 'MM') " +
                                              "order by r.room_name, MONTH asc");
            while(result.next()) {
                if(count == 0) {
                    RevenueTable.setValueAt(result.getString(1), rowCount, count++);
                    RevenueTable.setValueAt(result.getInt(3), rowCount, count++);
                    total += result.getInt(3);
                }
                else {
                    RevenueTable.setValueAt(result.getInt(3), rowCount, count++);
                    total += result.getInt(3);
                    if (count == 13) {
                        RevenueTable.setValueAt(total, rowCount, count);
                        count = 0;
                        total = 0;
                        rowCount++;
                    }
                }
            }
            
            RevenueTable.setValueAt("Totals", rowCount, 0);
            
            for(int i = 1; i < 14; i++) {
                sum = 0;
                for(int j = 0; j < 10; j++) {
                    sum += (Integer)RevenueTable.getValueAt(j, i);
                }
                RevenueTable.setValueAt(sum, 10, i);
            }
        }
        catch (Exception ee) {
            System.out.println(ee);
        }
    }//GEN-LAST:event_DaysOccupied

    private void ReservationCounts(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ReservationCounts
        int rowCount = 0;
        int count = 0;
        int total = 0;
        int sum;
        
        try {
            Statement s = InnReservations.conn.createStatement();
            ResultSet result = s.executeQuery("select r.room_name, to_char(re.check_out, 'MM') as MONTH, count(DISTINCT re.code) " +
                                              "from reservations re, rooms r " +
                                              "where re.room = r.room_id " +
                                              "group by r.room_name, to_char(re.check_out, 'MM') " +
                                              "order by r.room_name, MONTH asc");
            while(result.next()) {
                if(count == 0) {
                    RevenueTable.setValueAt(result.getString(1), rowCount, count++);
                    RevenueTable.setValueAt(result.getInt(3), rowCount, count++);
                    total += result.getInt(3);
                }
                else {
                    RevenueTable.setValueAt(result.getInt(3), rowCount, count++);
                    total += result.getInt(3);
                    if (count == 13) {
                        RevenueTable.setValueAt(total, rowCount, count);
                        count = 0;
                        total = 0;
                        rowCount++;
                    }
                }
            }
            
            RevenueTable.setValueAt("Totals", rowCount, 0);
            
            for(int i = 1; i < 14; i++) {
                sum = 0;
                for(int j = 0; j < 10; j++) {
                    sum += (Integer)RevenueTable.getValueAt(j, i);
                }
                RevenueTable.setValueAt(sum, 10, i);
            }
        }
        catch (Exception ee) {
            System.out.println(ee);
        }
    }//GEN-LAST:event_ReservationCounts

    private void OccupiedDateEnteredOccupancy(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_OccupiedDateEnteredOccupancy

        if(evt.getKeyCode() == ENTER) {

            String date = InnReservations.format_date(OccupiedDateTextFieldPOccupancy.getText());

            if(OccupiedDateTextFieldPOccupancy.isEditValid() && !date.isEmpty()) {
                
                occupied_entered = true;
                
                try {
                    String[] values = new String[10];
                    Statement s = InnReservations.conn.createStatement();
                    ResultSet result = s.executeQuery("((select distinct room_name, 'Empty' as Occupied" +
                                                        "   from rooms)" +
                                                        "   MINUS" +
                                                        "   (select distinct room_name, 'Empty' as Occupied" +
                                                        "   from reservations, rooms" +
                                                        "   where (check_in <= '" + date + "' and" +
                                                        "         check_out > '" + date + "') and" +
                                                        "         (room = room_id)" +
                                                        "   )" +
                                                        ") UNION" +
                                                        "(select distinct room_name, 'Occupied' as Occupied" +
                                                        "   from reservations, rooms" +
                                                        "   where (check_in <= '" + date + "' and" +
                                                        "         check_out > '" + date + "') and" +
                                                        "         (room = room_id))");
                    for(int i=0; result.next(); i++) {
                        values[i] = result.getString(1) + " --- " + result.getString(2);
                    }
                    
                    RoomList.setListData(values);
                } catch (Exception e) {
                    ;
                }
            }
        }
    }//GEN-LAST:event_OccupiedDateEnteredOccupancy

    private void EndDateEnteredOccupancy(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EndDateEnteredOccupancy

        if(evt.getKeyCode() == ENTER) {

            String startDate = InnReservations.format_date(StartDateTextFieldOccupancy.getText());
            String endDate = InnReservations.format_date(EndDateTextFieldOccupancy.getText());

            if(EndDateTextFieldOccupancy.isEditValid() && StartDateTextFieldOccupancy.isEditValid()
                && !startDate.isEmpty() && !endDate.isEmpty()) {

                occupied_entered = false;
                
                // Get values from database
                try {
                    
                    Statement s = InnReservations.conn.createStatement();
                    ResultSet result = s.executeQuery("select distinct d1 - d2 as d3 " +
                                                        "from " +
                                                        "(select room_id, to_date('" + endDate + "', 'DD-MON-YYYY') as D1 " +
                                                        "   from rooms " +
                                                        ") r1, " +
                                                        "(select room_id, to_date('" + startDate + "', 'DD-MON-YYYY') as D2 " +
                                                        "   from rooms " +
                                                        ") r2 " +
                                                        "where (r1.room_id = r2.room_id)");
                    result.next();
                    int num_days = result.getInt(1);
                    String[] room_names = new String[10];
                    
                    result = s.executeQuery("select room_name "
                            + "from rooms");
                    
                    for(int i=0; result.next(); i++) {
                        room_names[i] = result.getString(1);
                    }
                    
                    String[][] values = new String[10][num_days];
                    
                    for(int i=0; i<10; i++) {
                        for(int j=0; j<num_days; j++) {
                            result = s.executeQuery("select count(*) " +
                                                    "from reservations, rooms " +
                                                    "where (room_name = '" + room_names[i] + "') and " +
                                                    "      (check_in <= To_Date('" + startDate + "', 'DD-MON-YYYY') + INTERVAL '" + j + "' DAY(4) and " +
                                                    "      check_out >= To_Date('" + startDate + "', 'DD-MON-YYYY') + INTERVAL '" + (j+1) + "' DAY(4)) and " +
                                                    "      (room = room_id)");
                            result.next();
                            int count = result.getInt(1);
                            if(count == 0) {
                                values[i][j] = "empty";
                            } else {
                                values[i][j] = "occupied";
                            }
                        }
                    }
                    
                    for(int i=0; i<10; i++) {
                        int count = 0;
                        
                        for(int j=0; j<values[i].length; j++) {
                            if(values[i][j].equals("empty")) {
                                count++;
                            }
                        }
                        
                        if(count == 0) {
                            room_names[i] += " --- Occupied";
                        } else if(count == num_days) {
                            room_names[i] += " --- Empty";
                        } else {
                            room_names[i] += " --- Partially Occupied";
                        }
                    }
                    
                    RoomList.setListData(room_names);
                } catch (Exception e) {
                    ;
                }
            }
        }
    }//GEN-LAST:event_EndDateEnteredOccupancy

    private void DeleteDatabase(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_DeleteDatabase
        //delete database
        if(!InnReservations.empty_database) {
            try {
                Statement s1 = InnReservations.conn.createStatement();
                s1.executeUpdate("drop table rooms CASCADE CONSTRAINTS"); 
                s1.executeUpdate("drop table reservations CASCADE CONSTRAINTS");

                InnReservations.empty_database = true;
                InnReservations.reservations_count = 0;
                InnReservations.rooms_count = 0;

                setDatabaseStatus(InnReservations.reservations_count, InnReservations.rooms_count, InnReservations.empty_database);
                setReservationsStatus(InnReservations.reservations_count, InnReservations.empty_database);
                setRoomsStatus(InnReservations.rooms_count, InnReservations.empty_database);
            }
            catch(Exception e) {
                System.out.println(e);
            }
        }
    }//GEN-LAST:event_DeleteDatabase

    private void LoadDatabase(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LoadDatabase
        //load database
        FileReader fr = null;
        try {
            if(InnReservations.empty_database) {
                InnReservations.createTable("ROOMS");
                InnReservations.createTable("RESERVATIONS");
            }
            
            if(InnReservations.reservations_count == 0 && InnReservations.rooms_count == 0) {
                fr = new FileReader ("tuples.txt");
                BufferedReader br = new BufferedReader (fr);
                String str = br.readLine();
                Statement s1 = InnReservations.conn.createStatement();

                while(str != null) {
                    s1.executeUpdate(str);
                    str = br.readLine();
                }
                
                InnReservations.rooms_count = InnReservations.checkTable("ROOMS");
                InnReservations.reservations_count = InnReservations.checkTable("RESERVATIONS");
                
                InnReservations.empty_database = false;
            
                setDatabaseStatus(InnReservations.reservations_count, InnReservations.rooms_count, InnReservations.empty_database);
                setReservationsStatus(InnReservations.reservations_count, InnReservations.empty_database);
                setRoomsStatus(InnReservations.rooms_count, InnReservations.empty_database);
                
                res_code = InnReservations.get_start_res_code();
            }
            else {
                DatabaseStatusLabel.setText("Database Status: full (tables already exist and are populated)");
            }
            
        }catch (FileNotFoundException e) {
            System.out.println(e);
        }catch (IOException e) {
                System.out.println(e);
        }catch(SQLException e) {
                System.out.println(e);
        }   
    }//GEN-LAST:event_LoadDatabase

    private void ClearDataBase(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ClearDataBase
        // clear database
        if(!InnReservations.empty_database) {
            try{
                Statement s1 = InnReservations.conn.createStatement();
                s1.executeUpdate("delete from RESERVATIONS");
                s1.executeUpdate("delete from ROOMS");
                
                InnReservations.reservations_count = 0;
                InnReservations.rooms_count = 0;
                
                setDatabaseStatus(InnReservations.reservations_count, InnReservations.rooms_count, InnReservations.empty_database);
                setReservationsStatus(InnReservations.reservations_count, InnReservations.empty_database);
                setRoomsStatus(InnReservations.rooms_count, InnReservations.empty_database);
                
            } catch(SQLException e) {
                System.out.println(e);
            }
        }
    }//GEN-LAST:event_ClearDataBase

    private void ViewReservationsTable(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ViewReservationsTable
        
        if(evt.getStateChange() == ON) {
            view_reservations = true;
        } else {
            view_reservations = false;
        }

        if(view_reservations && !view_rooms)
        {
            // get reservation values from database
            if(!InnReservations.empty_database || !(InnReservations.reservations_count == 0 && InnReservations.rooms_count == 0)) {
                try{
                    int i = 0;
                    int[] Code = new int[InnReservations.reservations_count], 
                            Adults = new int[InnReservations.reservations_count], 
                            Kids = new int[InnReservations.reservations_count];
                    String[] Room = new String[InnReservations.reservations_count], 
                            LastName = new String[InnReservations.reservations_count], 
                            FirstName = new String[InnReservations.reservations_count],
                            values = new String[InnReservations.reservations_count];
                    java.sql.Date[] CheckIn = new java.sql.Date[InnReservations.reservations_count], 
                            CheckOut = new java.sql.Date[InnReservations.reservations_count];
                    float[] Rate = new float[InnReservations.reservations_count];
                    Statement s1 = InnReservations.conn.createStatement();
                    ResultSet result = s1.executeQuery("select * from RESERVATIONS");

                    boolean f = result.next();
                    while(f) {
                        Code[i] = result.getInt(1);
                        Room[i] = result.getString(2);
                        CheckIn[i] = result.getDate(3);
                        CheckOut[i] = result.getDate(4);
                        Rate[i] = result.getFloat(5);
                        LastName[i] = result.getString(6);
                        FirstName[i] = result.getString(7);
                        Adults[i] = result.getInt(8);
                        Kids[i] = result.getInt(9);

                        values[i] = Code[i] + ", " + Room[i] + ", " + CheckIn[i] + ", " + CheckOut[i] + ", " + 
                            Rate[i] + ", " + LastName[i] + ", " + FirstName[i] + ", " + Adults[i] + ", " + Kids[i];

                        f = result.next();
                        i++;
                    }

                    TableList.setListData(values);

                } catch(SQLException e) {
                    System.out.println(e);
                }
            }
        } else if (view_reservations && view_rooms) {
            String[] no_values = {""};
            TableList.setListData(no_values);
        } else if (!view_reservations && !view_rooms) {
            String[] no_values = {""};
            TableList.setListData(no_values);
        } else if (!view_reservations && view_rooms) {
            // get room values from database
            if(!InnReservations.empty_database || !(InnReservations.reservations_count == 0 && InnReservations.rooms_count == 0)) {
                try {
                    int i = 0;
                    String[] RoomId = new String[10], roomName = new String[10], bedType = new String[10], 
                            decor = new String[10], values = new String[10];
                    int[] beds = new int[10], maxOccupancy = new int[10];
                    Statement s1 = InnReservations.conn.createStatement();
                    ResultSet result = s1.executeQuery("select * from ROOMS");

                    boolean f = result.next();
                    while(f) {
                        RoomId[i] = result.getString(1);
                        roomName[i] = result.getString(2);
                        bedType[i] = result.getString(3);
                        decor[i] = result.getString(4);
                        beds[i] = result.getInt(5);
                        maxOccupancy[i] = result.getInt(6);

                        values[i] = RoomId[i] + ", " + roomName[i] + ", " + bedType[i] + ", " + decor[i] + ", " + 
                            beds[i] + ", " + maxOccupancy[i];

                        f = result.next();
                        i++;
                    }

                    TableList.setListData(values);

                }catch (SQLException e) {
                    System.out.println(e);
                }
            }
        }
    }//GEN-LAST:event_ViewReservationsTable

    private void ViewRoomsTable(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ViewRoomsTable

        if(evt.getStateChange() == ON) {
            view_rooms = true;
        } else {
            view_rooms = false;
        }

        if(view_rooms && !view_reservations)
        {
            // get room values from database
            if(!InnReservations.empty_database || !(InnReservations.reservations_count == 0 && InnReservations.rooms_count == 0)) {
                try {
                    int i = 0;
                    String[] RoomId = new String[10], roomName = new String[10], bedType = new String[10], 
                            decor = new String[10], values = new String[10];
                    int[] beds = new int[10], maxOccupancy = new int[10];
                    Statement s1 = InnReservations.conn.createStatement();
                    ResultSet result = s1.executeQuery("select * from ROOMS");

                    boolean f = result.next();
                    while(f) {
                        RoomId[i] = result.getString(1);
                        roomName[i] = result.getString(2);
                        bedType[i] = result.getString(3);
                        decor[i] = result.getString(4);
                        beds[i] = result.getInt(5);
                        maxOccupancy[i] = result.getInt(6);

                        values[i] = RoomId[i] + ", " + roomName[i] + ", " + bedType[i] + ", " + decor[i] + ", " + 
                            beds[i] + ", " + maxOccupancy[i];

                        f = result.next();
                        i++;
                    }

                    TableList.setListData(values);

                }catch (SQLException e) {
                    System.out.println(e);
                }
            }
        } else if (view_rooms && view_reservations) {
            String[] no_values = {""};
            TableList.setListData(no_values);
        } else if (!view_rooms && !view_reservations) {
            String[] no_values = {""};
            TableList.setListData(no_values);
        } else if (!view_rooms && view_reservations) {
            // get reservation values from database
            if(!InnReservations.empty_database || !(InnReservations.reservations_count == 0 && InnReservations.rooms_count == 0)) {
                try{
                    int i = 0;
                    int[] Code = new int[InnReservations.reservations_count], 
                            Adults = new int[InnReservations.reservations_count], 
                            Kids = new int[InnReservations.reservations_count];
                    String[] Room = new String[InnReservations.reservations_count], 
                            LastName = new String[InnReservations.reservations_count], 
                            FirstName = new String[InnReservations.reservations_count],
                            values = new String[InnReservations.reservations_count];
                    java.sql.Date[] CheckIn = new java.sql.Date[InnReservations.reservations_count], 
                            CheckOut = new java.sql.Date[InnReservations.reservations_count];
                    float[] Rate = new float[600];
                    Statement s1 = InnReservations.conn.createStatement();
                    ResultSet result = s1.executeQuery("select * from RESERVATIONS");

                    boolean f = result.next();
                    while(f) {
                        Code[i] = result.getInt(1);
                        Room[i] = result.getString(2);
                        CheckIn[i] = result.getDate(3);
                        CheckOut[i] = result.getDate(4);
                        Rate[i] = result.getFloat(5);
                        LastName[i] = result.getString(6);
                        FirstName[i] = result.getString(7);
                        Adults[i] = result.getInt(8);
                        Kids[i] = result.getInt(9);

                        values[i] = Code[i] + ", " + Room[i] + ", " + CheckIn[i] + ", " + CheckOut[i] + ", " + 
                            Rate[i] + ", " + LastName[i] + ", " + FirstName[i] + ", " + Adults[i] + ", " + Kids[i];

                        f = result.next();
                        i++;
                    }

                    TableList.setListData(values);

                } catch(SQLException e) {
                    System.out.println(e);
                }
            }
        }
    }//GEN-LAST:event_ViewRoomsTable

    private void PlaceReservation(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_PlaceReservation

        String start_date = InnReservations.format_date(StartDateTextFieldGuest.getText());
        String end_date = InnReservations.format_date(EndDateTextFieldGuest.getText());
        String room = (String) RoomSelectionGuest.getSelectedItem();
        String rate = (String) AvailabilityList.getValueAt(0, 2);
        
        PlaceReservationButton.setVisible(false);
        
        PlaceReservation(start_date, end_date, room, rate);
    }//GEN-LAST:event_PlaceReservation

    
    private void PlaceReservation(String start_date, String end_date, String room_name, String rate) {
        PlaceReservation pr = new PlaceReservation(start_date, end_date, room_name, rate);
        pr.setVisible(true);
    }
    
    private void CheckAvailability(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CheckAvailability
        String room = (String) RoomSelectionGuest.getSelectedItem();
        String startDate = InnReservations.format_date(StartDateTextFieldGuest.getText());
        String endDate = InnReservations.format_date(EndDateTextFieldGuest.getText());

        if(StartDateTextFieldGuest.isEditValid() && EndDateTextFieldGuest.isEditValid()
            && !room.equals("---") && !startDate.isEmpty() && !endDate.isEmpty()) {
            
            String[][] values = InnReservations.check_availability(room, startDate, endDate);
            
            for(int i=0; i<365; i++) {
                AvailabilityList.setValueAt("", i, 0);
                AvailabilityList.setValueAt("", i, 1);
                AvailabilityList.setValueAt("", i, 2);
            }
            
            boolean all_empty = true;
            
            for(int i=0; i<values[0].length; i++) {
                AvailabilityList.setValueAt(values[0][i], i, 0);
                AvailabilityList.setValueAt(values[1][i], i, 1);
                if(values[1][i].equals("occupied")) {
                    all_empty = false;
                }
                AvailabilityList.setValueAt(values[2][i], i, 2);
            }
            
            if(all_empty) {
                PlaceReservationButton.setVisible(true);
            } else {
                PlaceReservationButton.setVisible(false);
            }
        }
    }//GEN-LAST:event_CheckAvailability

    private void RoomSelectionGuest(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RoomSelectionGuest
        String room = (String) RoomSelectionGuest.getSelectedItem();

        if(!room.equals("---")) {
            // get room info from database
            String room_info = InnReservations.get_room_info(room, false);
            RoomInfoTextAreaGuest.setText(room_info);
        } else {
            RoomInfoTextAreaGuest.setText("");
        }
    }//GEN-LAST:event_RoomSelectionGuest

    private void EndDateEnteredGuestReservations(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_EndDateEnteredGuestReservations
        
        if(evt.getKeyCode() == ENTER) {
            String start_date = InnReservations.format_date(StartDateTextFieldGuestReservations.getText());
            String end_date = InnReservations.format_date(EndDateTextFieldGuestReservations.getText());
            
            String[][] values = InnReservations.get_available_rooms(start_date, end_date);
            
            for(int i=0; i<values[0].length; i++) {
                AvailabilityTableReservations.setValueAt(values[0][i], i, 0);
                AvailabilityTableReservations.setValueAt(values[1][i], i, 1);
            }
            
            RoomInfoTextAreaGuestReservations.setText("");
            
            MakeAReservation.setVisible(false);
        }
    }//GEN-LAST:event_EndDateEnteredGuestReservations

    private void AvailabilityTableReservationsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_AvailabilityTableReservationsMouseClicked
        
        try {
            String room = (String) AvailabilityTableReservations.getValueAt(AvailabilityTableReservations.getSelectedRow(), 0);
            
            if(!room.isEmpty()) {
                String room_info = InnReservations.get_room_info(room, false);
                RoomInfoTextAreaGuestReservations.setText(room_info);
                
                MakeAReservation.setVisible(true);
            } 
        } catch (Exception e) {
            RoomInfoTextAreaGuestReservations.setText("");
        }
        
        
    }//GEN-LAST:event_AvailabilityTableReservationsMouseClicked

    private void MakeReservation(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_MakeReservation
        String start_date = InnReservations.format_date(StartDateTextFieldGuestReservations.getText());
        String end_date = InnReservations.format_date(EndDateTextFieldGuestReservations.getText());
        String room = (String) AvailabilityTableReservations.getValueAt(AvailabilityTableReservations.getSelectedRow(), 0);
        String rate = (String) AvailabilityTableReservations.getValueAt(AvailabilityTableReservations.getSelectedRow(), 1);
        
        MakeAReservation.setVisible(false);
        
        PlaceReservation(start_date, end_date, room, rate);
    }//GEN-LAST:event_MakeReservation

    private void RoomSelected(ListSelectionEvent evt) {
        // Get room selected
        String room = (String) RoomList.getSelectedValue();
        String start_date = null, end_date = null;
        ArrayList<String> reservation_info = new ArrayList<String>();
        int count = 0;
        String all_reservations = "";
        
        if(occupied_entered) {
            start_date = InnReservations.format_date(OccupiedDateTextFieldPOccupancy.getText());
            end_date = start_date;
        } else {
            start_date = InnReservations.format_date(StartDateTextFieldOccupancy.getText());
            end_date = InnReservations.format_date(EndDateTextFieldOccupancy.getText());
        }
        
        String[] values = room.split("---");
        
        if(!values[1].trim().equals("Empty")) {
            // Get info about room from database
            try {
                Statement s = InnReservations.conn.createStatement();
                ResultSet result = s.executeQuery("select re.code, re.room, re.check_in, re.check_out " +
                                                    "from rooms r, reservations re " +
                                                    "where (r.Room_Name = '" + values[0].trim() + "') and " +
                                                    "      (re.Room = r.Room_Id) and " +
                                                    "      (re.Check_In <= '" + end_date + "' and " +
                                                    "      re.Check_Out > '" + start_date + "')");
                while(result.next()) {
                    reservation_info.add(result.getInt(1) +
                                                ", " + result.getString(2) +
                                                ", " + result.getDate(3).toString() +
                                                ", " + result.getDate(4).toString());
                    all_reservations += reservation_info.get(count) + "\n\n";
                    count++;   
                }
                
            } catch (Exception e) {
                System.out.println(e.toString());
            }
        } else {
            ReservationTextAreaOccupancy.setText("");
        }
        
        ReservationListOwner.setListData(reservation_info.toArray(new String[1]));
    }
    
    private void ReservationSelected(ListSelectionEvent evt) {
        // Get reservation selected
        String reservation = (String)ReservationListReservations.getSelectedValue();
        
        // Update info about reservation
        ReservationInfoTextAreaReservations.setText(InnReservations.get_reservation_info(reservation));
    }
    
    private void ReservationSelectedRooms(ListSelectionEvent evt) {
        // Get reservation selected
        String reservation_code = (String)ReservationListRooms.getSelectedValue();
        
        // Get info about reservation from database
        String reservation_info = InnReservations.get_reservation_info(reservation_code);
        
        // Update info about reservation
        ReservationInfoTextAreaRooms.setText(reservation_info);
    }
    
    private void ReservationSelectedOwner(ListSelectionEvent evt) {
        String reservation = (String)ReservationListOwner.getSelectedValue();
        
        ReservationTextAreaOccupancy.setText(InnReservations.get_reservation_info(reservation));
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTable AvailabilityList;
    private javax.swing.JTable AvailabilityTableReservations;
    private javax.swing.JButton CheckAvailabilityButton;
    private javax.swing.JButton ClearDatabaseButton;
    private javax.swing.JLabel DatabaseStatusLabel;
    private javax.swing.JButton DaysOccupiedButton;
    private javax.swing.JButton DeleteDatabaseButton;
    private javax.swing.JLabel EndDateLabel;
    private javax.swing.JFormattedTextField EndDateTextFieldGuest;
    private javax.swing.JFormattedTextField EndDateTextFieldGuestReservations;
    private javax.swing.JFormattedTextField EndDateTextFieldOccupancy;
    private javax.swing.JFormattedTextField EndDateTextFieldReservations;
    private javax.swing.JButton LoadDatabaseButton;
    private javax.swing.JTabbedPane MainPanel;
    private javax.swing.JButton MakeAReservation;
    private javax.swing.JLabel OccupiedDateLabel;
    private javax.swing.JFormattedTextField OccupiedDateTextFieldPOccupancy;
    private javax.swing.JButton PlaceReservationButton;
    private javax.swing.JLabel ReservationCompletedLabel;
    private javax.swing.JButton ReservationCounts;
    private javax.swing.JTextArea ReservationInfoTextAreaReservations;
    private javax.swing.JTextArea ReservationInfoTextAreaRooms;
    private javax.swing.JScrollPane ReservationInformationTextAreaOccupancy;
    private javax.swing.JList ReservationListOwner;
    private javax.swing.JList ReservationListReservations;
    private javax.swing.JList ReservationListRooms;
    private javax.swing.JTextArea ReservationTextAreaOccupancy;
    private javax.swing.JLabel ReservationsLabel;
    private javax.swing.JButton RevenueButton;
    private javax.swing.JTable RevenueTable;
    private javax.swing.JTextArea RoomInfoTextAreaGuest;
    private javax.swing.JTextArea RoomInfoTextAreaGuestReservations;
    private javax.swing.JTextArea RoomInfoTextAreaRooms;
    private javax.swing.JList RoomList;
    private javax.swing.JComboBox RoomSelectionGuest;
    private javax.swing.JComboBox RoomSelectionReservations;
    private javax.swing.JComboBox RoomSelectionRooms;
    private javax.swing.JLabel RoomsLabel;
    private javax.swing.JLabel StartDateLabel;
    private javax.swing.JFormattedTextField StartDateTextFieldGuest;
    private javax.swing.JFormattedTextField StartDateTextFieldGuestReservations;
    private javax.swing.JFormattedTextField StartDateTextFieldOccupancy;
    private javax.swing.JFormattedTextField StartDateTextFieldReservations;
    private javax.swing.JList TableList;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    // End of variables declaration//GEN-END:variables
    
    public void setDatabaseStatus(int r_count, int res_count, boolean empty) {
        if(empty)
        {
            DatabaseStatusLabel.setText("Database Status: no database");
        }
        else if(r_count == 0 && res_count == 0)
        {
            DatabaseStatusLabel.setText("Database Status: empty");
        }
        else
        {
            DatabaseStatusLabel.setText("Database Status: full");
        }
    }
    
    public void setReservationsStatus(int res_count, boolean empty) {
        if(empty)
        {
            ReservationsLabel.setText("Reservations: 0");
        }
        else
        {
            ReservationsLabel.setText("Reservations: " + res_count);
        }
    }
    
    public void setRoomsStatus(int r_count, boolean empty) {
        if(empty)
        {
            RoomsLabel.setText("Rooms: 0");
        }
        else 
        {
            RoomsLabel.setText("Rooms: " + r_count);
        }
    }
}
